﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StreamServer
{
    class Program
    {
        static void Main (string [] args)
        {
            for (;;)
            using (System.IO.Pipes.NamedPipeServerStream npss =
                new System.IO.Pipes.NamedPipeServerStream("testpipe", System.IO.Pipes.PipeDirection.Out))
            {
                Console.WriteLine("servidor creado");
                Console.WriteLine("esperando conexión");

                npss.WaitForConnection();

                try
                {
                    using (System.IO.StreamWriter sw = new System.IO.StreamWriter(npss))
                    {
                        string sss = new string ('X', 512);

                        for (; ; )
                            sw.WriteLine(sss);
                    }
                }
                catch (System.IO.IOException ioe)
                {
                    Console.WriteLine(ioe.Message);
                }
            }
        }
    }
}
